package com.xlh.param.course;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xlh.util.InputValidator;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import java.util.List;

/**
 * 章节参数
 * <p>
 * Created by lx on 2019/3/22.
 */
@Data
public class ChapterParam {

    @ApiModelProperty(value = "章节名称")
    @NotBlank(message = "章节名称不能为空")
    @Length(max = 50, message = "章节名称不能超过50个字符")
    private String name;

    @ApiModelProperty(value = "简介")
    @Length(max = 200, message = "简介不能超过200个字符")
    private String introduction;

    @JsonIgnore
    @ApiModelProperty(value = "类型")
    private Integer type;

    @ApiModelProperty(value = "类型名称")
    @NotBlank(message = "类型不能为空")
    @Length(max = 15, message = "类型不能超过15个字符")
    private String typeName;

    @ApiModelProperty(value = "技能")
    private String technologyIds;

    @ApiModelProperty(value = "技能集合")
    private List<Long> technologyIdList;

    @ApiModelProperty(value = "步骤类型字符串")
    private String stepTypeStr;

    @JsonIgnore
    @ApiModelProperty(value = "步骤类型")
    private Integer stepType;

    public String getName() {
        return name == null ? null : InputValidator.regSpecialChar(name);
    }

}
